package com.cyz.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyz.dao.TeacherDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.cyz.entity.TeacherEntity;
import com.cyz.service.TeacherService;




/**
 *
 *
 * @author chenyizhen
 * @email
 * @date 2023-12-26 14:18:30
 */
@RestController
@RequestMapping("teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;

    @Autowired
    TeacherDao teacherDao;


    @RequestMapping("/queryName")
    private List<String> queryName(){
        List<TeacherEntity> teacherEntities = teacherDao.selectList(new QueryWrapper<>());
        return teacherEntities.stream().map(item -> item.getName()).collect(Collectors.toList());
    }
    /**
     * 列表
     */
//    @RequestMapping("/list")
//    //@RequiresPermissions("user:teacher:list")
//    public R list(@RequestParam Map<String, Object> params){
//        PageUtils page = teacherService.queryPage(params);
//
//        return R.ok().put("page", page);
//    }
//
//
//    /**
//     * 信息
//     */
//    @RequestMapping("/info/{id}")
//    public R info(@PathVariable("id") Integer id){
//		TeacherEntity teacher = teacherService.getById(id);
//
//        return R.ok().put("teacher", teacher);
//    }
//
//    /**
//     * 保存
//     */
//    @RequestMapping("/save")
//    public R save(@RequestBody TeacherEntity teacher){
//		teacherService.save(teacher);
//
//        return R.ok();
//    }
//
//    /**
//     * 修改
//     */
//    @RequestMapping("/update")
//    public R update(@RequestBody TeacherEntity teacher){
//		teacherService.updateById(teacher);
//
//        return R.ok();
//    }
//
//    /**
//     * 删除
//     */
//    @RequestMapping("/delete")
//    public R delete(@RequestBody Integer[] ids){
//		teacherService.removeByIds(Arrays.asList(ids));
//
//        return R.ok();
//    }

}
